package com.ruoyi.module.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.module.mapper.OrderGoodsMapper;
import com.ruoyi.module.domain.OrderGoods;
import com.ruoyi.module.service.IOrderGoodsService;

/**
 * 订单对应商品Service业务层处理
 *
 * @author fubojin
 * @date 2024-12-23
 */
@Service
public class OrderGoodsServiceImpl implements IOrderGoodsService
{
    @Autowired
    private OrderGoodsMapper orderGoodsMapper;

    /**
     * 查询订单对应商品
     *
     * @param id 订单对应商品主键
     * @return 订单对应商品
     */
    @Override
    public OrderGoods selectOrderGoodsById(Long id)
    {
        return orderGoodsMapper.selectOrderGoodsById(id);
    }

    /**
     * 查询订单对应商品列表
     *
     * @param orderGoods 订单对应商品
     * @return 订单对应商品
     */
    @Override
    public List<OrderGoods> selectOrderGoodsList(OrderGoods orderGoods)
    {
        return orderGoodsMapper.selectOrderGoodsList(orderGoods);
    }

    /**
     * 新增订单对应商品
     *
     * @param orderGoods 订单对应商品
     * @return 结果
     */
    @Override
    public int insertOrderGoods(OrderGoods orderGoods)
    {
        orderGoods.setCreateTime(DateUtils.getNowDate());
        return orderGoodsMapper.insertOrderGoods(orderGoods);
    }

    /**
     * 修改订单对应商品
     *
     * @param orderGoods 订单对应商品
     * @return 结果
     */
    @Override
    public int updateOrderGoods(OrderGoods orderGoods)
    {
        return orderGoodsMapper.updateOrderGoods(orderGoods);
    }

    /**
     * 批量删除订单对应商品
     *
     * @param ids 需要删除的订单对应商品主键
     * @return 结果
     */
    @Override
    public int deleteOrderGoodsByIds(Long[] ids)
    {
        return orderGoodsMapper.deleteOrderGoodsByIds(ids);
    }

    /**
     * 删除订单对应商品信息
     *
     * @param id 订单对应商品主键
     * @return 结果
     */
    @Override
    public int deleteOrderGoodsById(Long id)
    {
        return orderGoodsMapper.deleteOrderGoodsById(id);
    }
}
